Skip to content

fix: Fix version detection in sphinx-multiversion documentation builds#618

Merged
laughingman7743 merged 2 commits intomasterfrom
fix-version-detection-in-multiversion-docs
Oct 18, 2025
Merged

fix: Fix version detection in sphinx-multiversion documentation builds#618
laughingman7743 merged 2 commits intomasterfrom
fix-version-detection-in-multiversion-docs

Conversation

@laughingman7743
Copy link
Member

Problem

When sphinx-multiversion builds documentation for different tags and branches, the version string was not correctly detected:

  • v3.18.0 showed "vNone"
  • v3.19.0 showed dev version instead of "v3.19.0"
  • v3.5.0 showed "v3.4.0" instead of "v3.5.0"

Solution

Added a config-inited event handler that uses sphinx-multiversion's smv_current_version config value to set the correct version:

  • For version tags (like "v3.19.0"), extract the version directly from the tag name
  • For branches (like "master"), fall back to git commands to get dev version
  • Removed uv build from Makefile since version is now set dynamically

Changes

  • docs/conf.py: Added config_inited() handler and setup() function for dynamic version detection
  • Makefile: Removed uv build step

Testing

Local build with make docs now correctly shows:

  • v3.18.0 → "v3.18.0" ✓
  • v3.19.0 → "v3.19.0" ✓
  • v3.5.0 → "v3.5.0" ✓
  • v3.17.1 → "v3.17.1" ✓
  • master → correct dev version ✓

Related Issues

Fixes version display issues reported in:

🤖 Generated with Claude Code

laughingman7743 and others added 2 commits October 18, 2025 18:06
This commit fixes the issue where documentation versions were displayed
incorrectly in the built HTML files.

## Problem

When sphinx-multiversion builds documentation for different tags and branches,
the version string was not correctly detected:
- v3.18.0 showed "vNone"
- v3.19.0 showed dev version instead of "v3.19.0"
- v3.5.0 showed "v3.4.0" instead of "v3.5.0"

## Solution

Added a `config-inited` event handler that uses sphinx-multiversion's
`smv_current_version` config value to set the correct version:
- For version tags (like "v3.19.0"), extract the version directly from the tag name
- For branches (like "master"), fall back to git commands to get dev version
- Removed `uv build` from Makefile since version is now set dynamically

## Testing

Local build with `make docs` now correctly shows:
- v3.18.0 → "v3.18.0" ✓
- v3.19.0 → "v3.19.0" ✓
- v3.5.0 → "v3.5.0" ✓
- master → correct dev version ✓

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove 'docs' from ruff exclude list in pyproject.toml
- Apply ruff formatting to docs/conf.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@laughingman7743 laughingman7743 marked this pull request as ready for review October 18, 2025 09:12
@laughingman7743 laughingman7743 merged commit 4026f3c into master Oct 18, 2025
5 checks passed
@laughingman7743 laughingman7743 deleted the fix-version-detection-in-multiversion-docs branch October 18, 2025 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant